'use strict';

var mongoose = require('mongoose'),
    Schema = mongoose.Schema,
    baseController = require('../../../Base/server/controllers/BaseDoc.js');

//质检指标
var newModel = baseController.getBaseDocFields();
//编码
newModel.Code = {
    type: String,
    trim: true,
    required: '请输入编码'
};
//名称
newModel.Name = {
    type: String,
    trim: true,
    required: '请输入名称'
};

//0: 数值  1: 字符串  2: 布尔  3: 选择
newModel.Type = {
    type: Number,
    default: 1
};
//可扩展枚举
newModel.ExtendEnum = {
    type: Schema.ObjectId,
    ref: 'ExtendEnum'
};
//单位
newModel.Unit = {
    type: String,
    trim: true
};
newModel.Remark = {
    type: String,
    default: '',
    trim: true
};

var newSchema = new Schema(newModel);
newSchema.index({Code: 1}, {"unique": true});

mongoose.model('QCNorm', newSchema, 'QCNorm');
